package com.sk.controller;

import com.sk.pojo.RespBean;
import com.sk.server.LoginServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("user")
public class LoginController {

    @Autowired
    LoginServer loginServer;

    @GetMapping("dockerTest")
    public String test(){
        return "docker";
    }

    @GetMapping("testSession")
    public Object testSession(HttpServletRequest request) {
        return request.getSession().getAttribute("username");
    }

    @PostMapping("login")
    public RespBean login(@RequestParam("tel")String tel,@RequestParam("pwd")String pwd,
                          HttpServletRequest request){

        return loginServer.login(tel,pwd,request);

    }




}
